package ua.org.extjsbuilder.parser.runtime.instructions;

import java.io.IOException;
import java.io.Writer;

import ua.org.extjsbuilder.parser.IInstruction;
import ua.org.extjsbuilder.parser.IScope;
import ua.org.extjsbuilder.parser.JSObject;

public class BinaryOperator implements IInstruction {
	public static final String PLUS_EQ = "+=";
	public static final String MINUS_EQ = "-=";
	public static final String MOD_EQ = "%=";
	public static final String DIV_EQ = "/=";
	public static final String MUL_EQ = "*=";
	public static final String AND_EQ = "&=";
	public static final String XOR_EQ = "^=";
	public static final String OR_EQ = "|=";
	public static final String INDEX = "[]";
	public static final String EQ = "=";
	public static final String AND = "&";
	public static final String XOR = "^";
	public static final String OR = "|";
	public static final String CONDITIONAL_AND = "&&";
	public static final String CONDITIONAL_OR = "||";
	public static final String MATCH = "===";
	public static final String COMPARE = "==";
	public static final String MATCH_NOT = "!==";
	public static final String COMPARE_NOT = "!=";
	public static final String GT_EQ = ">=";
	public static final String GT = ">";
	public static final String LT_EQ = "<=";
	public static final String LT = "<";
	public static final String PLUS = "+";
	public static final String MINUS = "-";
	public static final String MULTIPLY = "*";
	public static final String DIVIDE = "/";
	
	private String type;
	
	private IInstruction firstArg;
	private IInstruction secondArg;

	public BinaryOperator(String type, 
			IInstruction firstArg, IInstruction secondArg) {
		this.type = type;
		this.firstArg = firstArg;
		this.secondArg = secondArg;
	}

	public void compile(Writer out, boolean optimize) throws IOException {
		// TODO Auto-generated method stub
		
	}

	public JSObject execute(IScope scope, JSObject[] args) {
		// TODO Auto-generated method stub
		return null;
	}

	public String getName() {
		return type;
	}

	public IInstruction getFirstArg() {
		return firstArg;
	}

	public IInstruction getSecondArg() {
		return secondArg;
	}
}
